import styles from './index.module.css'
import { useNavigate } from 'react-router-dom'
import { relative } from '../../../utils/dayjs'
export default ({ data }) => {
    const navigate = useNavigate()
    switch (data.cover.type) {
        case 0:
            return (<div className={styles.articleItem} onClick={() => { navigate(`/article/${data.art_id}`) }}>
                <h5 className={styles.title}>{data.title}</h5>
                <div className={styles['label-wrap']}>
                    <span data-v-98fc16cc="">{data.aut_name}</span>
                    <span data-v-98fc16cc="">{data.comm_count}评论</span>
                    <span data-v-98fc16cc="">{relative(data.pubdate)}</span>
                </div>
            </div>)
            break;
        case 1:
            return (<div className={styles.articleItem} onClick={() => { navigate(`/article/${data.art_id}`) }}>
                <div className={styles.oneImage}>
                    <div className={styles.left}>
                        <h5 className={styles.title}>{data.title}</h5>
                        <div className={styles['label-wrap']}>
                            <span data-v-98fc16cc="">{data.aut_name}</span>
                            <span data-v-98fc16cc="">{data.comm_count}评论</span>
                            <span data-v-98fc16cc="">{relative(data.pubdate)}</span>
                        </div>
                    </div>
                    <img src={data.cover.images[0]} />
                </div>
            </div>)
            break;
    }
    return (<div className={styles.articleItem} onClick={() => { navigate(`/article/${data.art_id}`) }}>
        <h5 className={styles.title}>{data.title}</h5>
        <div className={styles.three}>
            <img src={data.cover.images[0]} />
            <img src={data.cover.images[1]} />
            <img src={data.cover.images[2]} />
        </div>
        <div className={styles['label-wrap']}>
            <span data-v-98fc16cc="">{data.aut_name}</span>
            <span data-v-98fc16cc="">{data.comm_count}评论</span>
            <span data-v-98fc16cc="">{relative(data.pubdate)}</span>
        </div>
    </div>)
}